export default ({$axios}, inject) => {

  // 文章-根据文章ID-查询文章详情（  @PathVariable 传参方式 ）
  inject('getArticleById', articleId => $axios.$get(`/article/api/article/${articleId}`))
  // 文章-根据ID删除文章
  inject('removeArticleById', articleId => $axios.$delete(`/article/article/remove/${articleId}`))
  // 举报-新增举报文章
  inject('addReport', data => $axios.$post('/article/report/add', data))

  // 收藏-是否已收藏
  inject('isCollect', (articleId, userId) => $axios.$get(`/article/api/collect/is-collect/${articleId}/${userId}`))
  // 收藏-文章
  inject('addCollect', (articleId, entityUserId) => $axios.$post(`/article/collect/${articleId}/${entityUserId}`))
  // 收藏-取消收藏文章
  inject('removeCollect', (articleId) => $axios.$delete(`/article/collect/remove/${articleId}`))
  // 点赞-是否已点赞（参数：当前登录用户ID、实体目标文章ID、实体类型文章1、文章作者ID）
  inject('isThumb', (userId, entityId, entityType, entityUserId) => $axios.$get(`/article/api/thumb/${userId}/${entityId}/${entityType}/${entityUserId}`))
  // 点赞-文章（参数：文章ID、点赞类型、作者ID）
  inject('addThumb', (entityId, entityType, entityUserId) => $axios.$post(`/article/thumb/add/${entityId}/${entityType}/${entityUserId}`))
  // 点赞-取消点赞文章（参数：文章ID、点赞类型、作者ID）
  inject('removeThumb', (entityId, entityType, entityUserId) => $axios.$delete(`/article/thumb/remove/${entityId}/${entityType}/${entityUserId}`))
  // 点赞-留言
  inject('addCommentThumb', (articleId, entityId, entityType, entityUserId) => $axios.$post(`/article/thumb/add-and-del/${articleId}/${entityId}/${entityType}/${entityUserId}`))
  // 点赞-回复
  inject('addReplyThumb', (articleId, entityId, entityType, entityUserId) => $axios.$post(`/article/thumb/reply-add-thumb/${articleId}/${entityId}/${entityType}/${entityUserId}`))

  // 奖励-是否已奖励（参数：当前登录用户ID、文章ID）
  inject('isAward', (userId, articleId) => $axios.$get(`/article/api/award/is-award/${userId}/${articleId}`))
  // 奖励-新增奖励文章作者
  inject('addAward', data => $axios.$post(`/article/award/add/`, data))

  // 留言-条件分页查询留言列表-前三条最热回复
  inject('getCommentList', (userId, articleId, current, size, showTop, query) => $axios.$get(`/article/api/comment/list/${userId}/${articleId}/${current}/${size}/${showTop}`, {params: query}))
  // 留言-新增
  inject('addComment', data => $axios.$post('/article/comment/add', data))

  // 回复-根据留言ID-分页查询回复列表
  inject('getReplyListByCommentId', (userId, commentId, replyCurrent, replySize) => $axios.$get(`/article/api/reply/list/${userId}/${commentId}/${replyCurrent}/${replySize}`))
  // 回复-新增回复
  inject('addReply', data => $axios.$post(`/article/reply/add`, data))

  // 留言-根据留言ID删除留言-批量删除对应的回复-文章留言数 - 1
  inject('removeCommentById', commentId => $axios.$delete(`/article/comment/remove/${commentId}`))
  // 回复-根据回复ID删除回复-对应留言回复数 - 1
  inject('removeReplyById', replyId => $axios.$delete(`/article/reply/remove/${replyId}`))

  // 文章详情右则 - 轮播图
  inject('getArticleLooperList', () => $axios.$get(`/article/api/looper/article`))

  // 关注-是否已关注
  inject('isFollow', (userId, followUserId) => $axios.$get(`/system/api/follow/is-follow/${userId}/${followUserId}`))
  // 关注
  inject('follow', (followUserId) => $axios.$post(`/system/follow/${followUserId}`))
  // 关注-取消关注
  inject('unFollow', (followUserId) => $axios.$delete(`/system/follow/remove/${followUserId}`))

  // 私信-发送私信
  inject('sendMessage', data => $axios.$post(`/system/message`, data))

  // 文章-新增文章
  inject('addArticle', data => $axios.$post(`/article/article/add`, data))
  // 所有文章图片-新增文章时保存用户上传的所的图片-系统比对删除垃圾图片用
  inject('addPicture', data => $axios.$post(`/sms/picture/add`, data))

  // 文章-查看编辑状态-文章、草稿详情
  inject('getEditArticleById', articleId => $axios.$get(`/article/article/user/edit/${articleId}`))

  // 文章-编辑文章或草稿
  inject('updateArticle', data => $axios.$put(`/article/article/update`, data))

  // 草稿-查看草稿详情
  inject('getArticleDraftInfoById', articleId => $axios.$get(`/article/article/draft/${articleId}`))

  // ES 搜索文章
  inject('search', (keyword, current, size) => $axios.$get(`/article/api/article/search/${keyword}/${current}/${size}`))


}
